package com.yy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 处理HTTP请求
 */
@Controller
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        System.out.println("=============");
        return "success";
    }

    /**
     * 返回ModelAndView
     * view 视图
     * Model：业务处理返回的数据
     * 了解
     */
    @RequestMapping("/hello2")
    public ModelAndView hello2(){
        ModelAndView mv=new ModelAndView();
        //数据进行封装
        mv.addObject("msg","Hello World");
        //要返回到哪个页面
        mv.setViewName("success");
        return mv;
    }
}
